LDFLAGS = -lm -lpthread -ggdb
M4 = m4

CFLAGS = -D_REENTRANT

ifeq (${DEBUG},yes)
	CFLAGS += -DHLRC_DEBUG -DCOPY_ON_RECV -DCOPY_ON_SEND
endif

TARGET = kdtree
OBJS = 	kdtree.o hlrc.o

INCLUDE = -I. 

$(TARGET): $(OBJS)
	gcc $(CFLAGS) $(OBJS) -o $(TARGET) $(LDFLAGS) $(LIBS)

.SUFFIXES:
.SUFFIXES:	.o .c .C .h .H

.H.h:
	$(M4) $(MACROS) $*.H > $*.h

.C.c:
	$(M4) $(MACROS) $*.C > $*.c

.c.o:
	gcc $(CFLAGS) -c $(INCLUDE)  $*.c -o $*.o -ggdb

clean:
	rm -f $(TARGET) $(OBJS) core *~ *.o kdtree kdtree.stat

#kdtree.c: kdtree.C